/**
 * 
 */
package org.jenkon.filter;

/**
 * Implementation of {@link Filter} to reversing the result of the decorating {@link #filter}.
 * 
 * @author Jens Konopka
 * 
 * @param <T> the type of value object to filter.
 */
public class ReverseFilter<T> implements Filter<T> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3244452421189947111L;

	/**
	 * the decorating {@link Filter} to reversing.
	 */
	private final Filter<T> filter;

	/**
	 * Create a new instance of this with decorating {@link Filter} to reversing.
	 * 
	 * @param filter the decorating {@link Filter} to reversing
	 */
	public ReverseFilter(final Filter<T> filter) {
		this.filter = filter;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.jenkon.lang.filter.Filter#accept(java.lang.Object)
	 */
	public boolean accept(final T value) {
		return !filter.accept(value);
	}

}
